package org.openzip.openzip.gui.util.fileTree.event;

import javax.swing.tree.TreePath;

import org.openzip.openzip.gui.util.checkBox.State;

/**
 * This class is the Event class for the TreeCheckSelectionChanged event.
 * @author Jakub Závěrka
 */
public class TreeCheckSelectionEvent
{
	private TreePath path;
	private Object source;
	private State oldState;
	private State newstate;
	
	/**
	 * Constructor for creating a new event.
	 * 
	 * @param path
	 *           <code>TreePath</code> to the node with changed checkbox.
	 * @param source
	 *           The object that raised the event.
	 * @param oldState
	 *           Old state of the checkbox.
	 * @param newState
	 *           New state of the checkbox.
	 */
	public TreeCheckSelectionEvent(TreePath path, Object source, State oldState,
				State newState){
		super();
		this.path = path;
		this.source = source;
		this.oldState = oldState;
		this.newstate = newState;
	}

	/**
	 * Returns the <code>TreePath</code> to the changed node.
	 */
	public TreePath getPath(){
		return path;
	}
	
	/**
	 * Returns the object that originally caused the event.
	 */
	public Object getSource(){
		return source;
	}
	
	/**
	 * Returns the old state of the checkbox.
	 */
	public State getOldState(){
		return oldState;
	}
	
	/**
	 * Returns the new state of the checkbox (the state checkbox changed to).
	 */
	public State getState(){
		return newstate;
	}
}
